package com.micro.school.order.service.impl;

import com.micro.school.common.core.domain.R;
import com.micro.school.order.service.IStudentService;
import com.micro.school.system.api.RemoteUserService;
import com.micro.school.system.api.domain.StudentInfos;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 学生查询
 */
@Service
public class StudentServiceImpl implements IStudentService
{
    @Autowired
    private RemoteUserService userService;
    @Override
    public Map<Long,StudentInfos> queryStudentByIds(List<Long> ids) {
        Map<Long,StudentInfos> result = new HashMap<>();
        R<List<StudentInfos>> studentsR = userService.queryStudentByIds(ids);
        if(null==studentsR || studentsR.getData()==null){
            return result;
        }
        List<StudentInfos> students = studentsR.getData();
        if(null==students || students.isEmpty()){
            return result;
        }
        for(StudentInfos studentInfos:students){
            result.put(studentInfos.getId(),studentInfos);
        }
        return result;
    }
}
